package com.tanhua.sso.controller;

import com.tanhua.common.vo.PicUploadResult;
import com.tanhua.sso.service.PicUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created by 景银泰
 * date 2020-11-09 16:30
 * Description : 上传图片接口
 * Version :
 */
@RequestMapping("/pic")
@Controller
public class PicUploadController {

    @Autowired
    private PicUploadService picUploadService;

    @RequestMapping("/upload")
    @ResponseBody
    public PicUploadResult upload(@RequestParam("file") MultipartFile multipartFile) {
        System.out.println("***********************************");
        System.out.println("图片上传测试");
        System.out.println(multipartFile.getName());
        System.out.println(multipartFile.getOriginalFilename());
        return this.picUploadService.upload(multipartFile);
    }
}
